package com.example.langchanin4jdemo1.controller;

import dev.langchain4j.community.model.dashscope.QwenEmbeddingModel;
import dev.langchain4j.data.embedding.Embedding;
import dev.langchain4j.model.embedding.EmbeddingModel;
import dev.langchain4j.model.output.Response;

public class EmbeddingDemo1 {
    public static void main(String[] args) {
        EmbeddingModel embeddingModel = QwenEmbeddingModel
                .builder()
                .apiKey("sk-875dd6ef14244431acdc7ccb974f5bfe")
                .modelName("text-embedding-v2")
                .build();
        Response<Embedding> embed = embeddingModel.embed("你好，你是我的好朋友小明");
        System.out.println(embed.content().toString());
        System.out.println(embed.content().vector().length);
    }
}
